import requests from '@/utils/request-proxy'

//获取全部商品数据
export const reqGetGoodInfo = () => requests({ url: `/goods`, method: 'get' })

//分页获取商品
export const reqGetGoodsByPage = (currentPage, size) => requests({ url: `/goods/page/${currentPage}/${size}`, method: 'get' })

//根据商品名称搜索
export const reqGetGoodInfoByName = (param) => requests({ url: `/goods/${param}`, method: 'get' })

//根据商品名搜索（分页）
export const reqGetGoodByGoodNamePage = (currentPage, limit, goodName) => requests({ url: `/goods/pageByGoodName/${currentPage}/${limit}/${goodName}`, method: 'get' })

//获取商品分类
export const reqGetGoodClassify = () => requests({ url: `/goods/classify`, method: 'get' })

//根据商品分类搜索
export const reqGetGoodInfoByClassify = (param) => requests({ url: `/goods/classify/${param}`, method: 'get' })

//根据分类获取商品（分页）
export const reqGetGoodByClassifyPage = (currentPage, limit, classify) => requests({ url: `/goods/pageByClassify/${currentPage}/${limit}/${classify}`, method: 'get' })

//添加商品
export const reqAddGoodInfo = (param) => requests({ url: "/goods", method: 'post', data: param })

//根据商品ID修改商品
export const reqUpdateGoodInfo = (param) => requests({ url: "/goods", method: 'put', data: param })

//根据商品ID修改上架状态
export const reqUpdateGoodStatus = (goodId) => requests({ url: `/goods/status/${goodId}`, method: 'put' })

//根据ID删除商品
export const reqDeleteGoodInfo = (goodId) => requests({ url: `/goods/${goodId}`, method: 'delete' })

//添加商品分类
export const reqAddGoodClassify = (classify) => requests({ url: `/goods/addClassify/${classify}`, method: 'post' })

//根据ID修改分类名
export const reqUpdateGoodClassify = (param) => requests({ url: `/goods/updateClassify`, method: 'put', data: param })

//根据ID删除商品分类
export const reqDeleteClassify = (id) => requests({ url: `/goods/classify/${id}`, method: 'delete' })



